package com.qtz.q6iflyspeech.util;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * Created by hy on 2017/4/4.
 */
public class FileUtil {
    /**
     * 读取asset目录下音频文件。
     *
     * @return 二进制文件数据
     */
    public static byte[] readAudioFile( String filename) {
        try {
            FileInputStream ins = new FileInputStream(filename);
            byte[] data = new byte[ins.available()];

            ins.read(data);
            ins.close();

            return data;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return null;
    }
}
